package us.mooresr.geartrack.client.gin;

import com.gwtplatform.dispatch.shared.SecurityCookie;
import com.gwtplatform.mvp.client.gin.AbstractPresenterModule;
import com.gwtplatform.mvp.client.gin.DefaultModule;
import us.mooresr.geartrack.client.place.ClientPlaceManager;
import us.mooresr.geartrack.client.place.DefaultPlace;
import us.mooresr.geartrack.client.place.NameTokens;
import us.mooresr.geartrack.client.core.desktop.DesktopBorrowViewImpl;
import us.mooresr.geartrack.client.core.desktop.DesktopItemTypeViewImpl;
import us.mooresr.geartrack.client.core.desktop.DesktopLocationViewImpl;
import us.mooresr.geartrack.client.core.desktop.DesktopMainViewImpl;
import us.mooresr.geartrack.client.core.desktop.DesktopItemViewImpl;
import us.mooresr.geartrack.client.core.desktop.DesktopPeopleViewImpl;
import us.mooresr.geartrack.client.core.desktop.DesktopReturnItemViewImpl;
import us.mooresr.geartrack.client.core.presenter.BorrowPresenter;
import us.mooresr.geartrack.client.core.presenter.MainPresenter;
import us.mooresr.geartrack.client.core.presenter.ItemPresenter;
import us.mooresr.geartrack.client.core.presenter.ReturnItemPresenter;
import us.mooresr.geartrack.client.core.presenter.PeoplePresenter;
import us.mooresr.geartrack.client.core.presenter.LocationPresenter;
import us.mooresr.geartrack.client.core.presenter.ItemTypePresenter;


public class ClientModule extends AbstractPresenterModule {

	@Override
	protected void configure() {
		install(new DefaultModule(ClientPlaceManager.class));

		bindPresenter(MainPresenter.class, MainPresenter.MyView.class,
				DesktopMainViewImpl.class, MainPresenter.MyProxy.class);

		bindConstant().annotatedWith(DefaultPlace.class).to(NameTokens.borrow);
		bindConstant().annotatedWith(SecurityCookie.class).to("JSESSIONID");

		bindPresenter(BorrowPresenter.class, BorrowPresenter.MyView.class,
				DesktopBorrowViewImpl.class, BorrowPresenter.MyProxy.class);

		bindPresenter(ItemPresenter.class, ItemPresenter.MyView.class,
				DesktopItemViewImpl.class, ItemPresenter.MyProxy.class);

		bindPresenter(ReturnItemPresenter.class,
				ReturnItemPresenter.MyView.class, DesktopReturnItemViewImpl.class,
				ReturnItemPresenter.MyProxy.class);

		bindPresenter(PeoplePresenter.class, PeoplePresenter.MyView.class,
				DesktopPeopleViewImpl.class, PeoplePresenter.MyProxy.class);

		bindPresenter(LocationPresenter.class, LocationPresenter.MyView.class,
				DesktopLocationViewImpl.class, LocationPresenter.MyProxy.class);

		bindPresenter(ItemTypePresenter.class, ItemTypePresenter.MyView.class,
				DesktopItemTypeViewImpl.class, ItemTypePresenter.MyProxy.class);
	}
}
